package First;

public class DeliveryMan extends Person{
	String[] areas;
	
	public DeliveryMan(String id, String name, String[] areas) {
		super(id,name);
		this.areas=areas;
	}
	
	public boolean check(String area) {
		for(String s:areas) {
			if(s.equalsIgnoreCase(area)) {
				return true;
			}
		}
		return false;
	}
	
	
	public String toString() {
		String result="deliveryMan info"+"\n"+
					  "Id:"+Id+"\n"+
			          "Name:"+name+"\n"+
			          "delivery area:";
		for(String area:areas) {
			if(area==areas[0]) {
				result+=area;
			}
			else {
				result+=","+area;	
			}
		}
		return result;
	}
}